$(function () {
	//获取焦点
	$("#regpassword").on("focus", "input", function () {
		$(this).closest('.inputstyle').addClass('focus');
	}).on("blur", "input", function () {
		$(this).closest('.inputstyle').removeClass('focus');
	});

	var password = $("#regpassword").Validform({
		btnSubmit: ".form_btn",
		tiptype: 4,
		showAllError: true,
		ajaxPost: true,
		usePlugin: {
			passwordStrength: {
				minLen: 6,
				maxLen: 18
			}
		},
		callback: function (data) {
			if (data.code > 0) {
				$(".bot_con_bg").removeClass("errors").addClass("succes");
				$(".zhedang").fadeIn(250);
				$(".duifou").fadeIn(300);
				$(".bot_con_txt").html(data.msg);
				setTimeout(function () {
					window.location.href = data.data;
				}, 3000);
			}
			if (data.code == 0) {
				$(".bot_con_bg").removeClass("succes").addClass("errors");
				$(".zhedang").fadeIn(350);
				$(".duifou").fadeIn(400);
				$(".bot_con_txt").html("对不起，" + "<em>" + data.info + "</em>" + "请修改后重新提交！");
			}
		}
	});

	password.addRule([
		{
			ele: "#password",
			datatype: "*6-18",
			sucmsg: "&nbsp;&nbsp;",
			placeholder: "请设置密码",
			autocomplete: "off"
		},
		{
			ele: "#repassword",
			datatype: "*6-18",
			recheck: "password",
			sucmsg: "&nbsp;&nbsp;",
			placeholder: "请重复密码",
			autocomplete: "off"
		}
	]);
});


